package com.trabpoo.megamanxrunner;

import java.awt.Rectangle;

import javax.swing.ImageIcon;


public class Spinningwall extends GameElement {
	
	private ImageIcon swall[] = new ImageIcon[16];
	private int cena=0;	
	public boolean active = true;
	//private Megaman megaman;
	Rectangle hitBox;
	public Spinningwall(){
		initializeswall();
		setPosY(120);
		setPosX(600);
	}
	
	private void initializeswall(){
		
		swall[0] = new ImageIcon("enemy/swall/sw1.png");
		swall[1] = new ImageIcon("enemy/swall/sw1.png");
		swall[2] = new ImageIcon("enemy/swall/sw2.png");
		swall[3] = new ImageIcon("enemy/swall/sw3.png");
		swall[4] = new ImageIcon("enemy/swall/sw4.png");
		swall[5] = new ImageIcon("enemy/swall/sw5.png");
		swall[6] = new ImageIcon("enemy/swall/sw6.png");
		swall[7] = new ImageIcon("enemy/swall/sw7.png");
		swall[8] = new ImageIcon("enemy/swall/sw8.png");
		swall[9] = new ImageIcon("enemy/swall/sw9.png");
		swall[10] = new ImageIcon("enemy/swall/sw10.png");
		swall[11] = new ImageIcon("enemy/swall/sw11.png");
		swall[12] = new ImageIcon("enemy/swall/sw12.png");
		swall[13] = new ImageIcon("enemy/swall/sw13.png");
		swall[14] = new ImageIcon("enemy/swall/sw14.png");
		swall[15] = new ImageIcon("enemy/swall/sw15.png");		
	}
	
	public int getCena(){		
		return cena;
	}
	
	public ImageIcon getIcon(){		
			return swall[cena];
		
	}
	
	public int getSpriteWidth(){
		return swall[cena].getImage().getWidth(null);
	}
	
	public int getSpriteHeight(){
			return swall[cena].getImage().getHeight(null);		
	}
	
	public void fall(){
		if(active){
			cena++;
			cena++;
			cena++;
			if (cena == 15)
				active = false;
		}
		
	}
	public void setHitBox(){
		hitBox = new Rectangle(getPosX(), getPosY(), 30, 200);
	}
	public Rectangle getHitBox(){
		return hitBox;
	}
	public void update(){
		this.setPosX(getPosX() + getVelX());
		setHitBox();
	}	
	
}
